home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / INFO / DOSTIPS5.ZIP / DOSKYBD < prev    next >
Text File  |  1986-06-28  |  5KB  |  111 lines

  1.                      IBM Keyboard Customizer
  2.        (COMPUTE! Magazine July 1986 by David Engebretsen)
  3.  
  4.      It is surprisingly easy to reassign any key or keys to a location
  5. that suits your own personal needs.  The first step is to create a
  6. CONFIG.SYS file that installs an extended screen and keyboard control
  7. device driver when you boot the system.  At the DOS prompt, simply
  8. type:
  9.  
  10. A>COPY CON:CONFIG.SYS
  11. DEVICE=ANSI.SYS
  12.  
  13. Press the F6 key followed by Return.  The configuration file runs
  14. automatically when you boot the computer, and it is ready to accept
  15. new key assignments.
  16.      The next step is to do the actual key switching.  Since this can
  17. involve some odd character sequences, it's easiest to do this from
  18. within a BASIC program that stores the needed data in a text file on
  19. disk.  Use this program to create a file that changes the uppercase Q
  20. to an uppercase D:
  21.  
  22. 10 A$=CHR$(27)+"["+CHR$(34)+"Q"+CHR$(34)+";"+CHR$(34)+"D"+CHR$(34)+"p"
  23. 20 OPEN "KEY.TXT" FOR OUTPUT AS #1
  24. 30 PRINT #1,A$
  25. 40 CLOSE #1
  26.  
  27. Save this program as REASSIGN.BAS and run it.  REASSIGN.BAS creates a
  28. text file that contains the following character sequence:
  29.  
  30. ESC["Q";"D"p
  31.  
  32. CHR$(27) is the ASCII code for the ESC character; this is the control
  33. code which changes the uppercase Q into an uppercase D.  To implement
  34. this change, insert the disk containing your new CONFIG.SYS file, then
  35. reboot.  This enables the ANSI device driver which in turn allows the
  36. keyboard to be redefined.
  37.      Type TYPE KEY.TXT at the DOS prompt and press Return.  This enters
  38. the special control characters into the computer's memory.  Now when
  39. you type an uppercase Q, the system substitutes an uppercase D.
  40.      The same technique can be used to create a keyboard macro -- a
  41. key that produces a multicharacter word or phrase with just one
  42. keystroke.  To illustrate, uppercase Q can be redefined so that it
  43. prints the phrase "The Phrase."  Replace line 10 in the BASIC program
  44. above with:
  45.  
  46. 10 A$=CHR$(27)+"["+CHR$(34)+"Q"+CHR$(34)+";"+CHR$(34)+"The Phrase"+CHR$(34)+"p"
  47.  
  48. Run the program again.  This creates a text file with these characters:
  49.  
  50. ESC["Q";"The Phrase"p
  51.  
  52. Return to DOS and type TYPE KEY.TXT again.  Now when you press Q the
  53. computer prints The Phrase on the screen.
  54.      When creating the KEY.tXT file, it is also acceptable to use an
  55. ASCII code for the character.  For example, if you want to change
  56. uppercase Q back to uppercase D, change line 10 in the program to:
  57.  
  58. 19 A$=CHR$(27)+"[81;68p"
  59.  
  60. Run the program, return to DOS, type TYPE KEY.TXT, and uppercase Q
  61. will produce uppercase D again.
  62.      By supplying an extended ASCII code, you can redefine the ten
  63. function keys alone or in conjunction with the Ctrl, Shift, or Alt
  64. keys.  That comes to four sets of ten, or 40 keys.  Rerun the program
  65. with line 10 changed to:
  66.  
  67. 10 A$=CHR$(27)+"[0;84;"+CHR$(34)+"DIR"+CHR$(34)+";13p"
  68.  
  69. The following text file is created:
  70.  
  71. ESC [0;84;"DIR";p
  72.  
  73. The 0 before the 84 tells the computer to look for an extended keycode
  74. -- a code that signals a special key combination.  The extended keycode
  75. 84 represents Shift-F1, and this key combination is redefined so that
  76. it prints DIR followed by a carriage return.  Run the program, return
  77. to DOS, and type TYPE KEY.TXT.  Now when you hold down Shift and press
  78. F1, the disk directory is displayed.
  79.      Note the number 13 just before the p in this character sequence.
  80. This is the ASCII code for Return.  Adding this character to the end
  81. of a character sequence has the same effect as pressing Return manually
  82. on the keyboard.  The computer types the letters D-I-R, then issues a
  83. Return to carry out the command.
  84.      Using a similar method, you can also change the screen color or
  85. shift to a different screen resolution.  To change colors, replace the
  86. lowercase p in line 10 with a lowercase m, and supply an appropriate
  87. color number.  For instance, change line 10 to:
  88.  
  89. 10 A$=CHR$(27)+"[37;44m"
  90.  
  91. Now the program creates this text file:
  92.  
  93. ESC [37;44m
  94.  
  95. When this file is TYPEd from DOS, the screen turns blue.
  96.      The same procedure works for changing the screen mode.  Change
  97. line 10 to:
  98.  
  99. 10 A$=CHR$(27)+"[=1h"
  100.  
  101. When you TYPE the resulting file from DOS, the screen goes into 40 x 25
  102. color text mode.  To obtain 320 x 200 color graphics mode, simply
  103. change the number 1 in line 10 to a 4.
  104.      The customizations you create using these techniques stay in
  105. effect as long as you are working in DOS or a DOS-related program.
  106. These changes disappear, however, if you reboot the computer, go to
  107. BASIC, or run an application that imposes its own definitions on the
  108. system.
  109.      The ASCII codes for the various characters and colors are listed
  110. in the BASIC and DOS manuals.
  111.